//
//  EGMBleSportsOperation.h
//  EGMLibrary
//
//  Created by hh on 16/10/26.
//  Copyright © 2016年 egoman. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "EGMBleOperation.h"

//#define DEF_MASS_CMD_TIMEOUT_SECOND 2*60
//#define DEF_MASS_CMD_TIMEOUT_SECOND 5

//-----------------------------------------------------------
#pragma mark - EGMBleSportsOperation
//-----------------------------------------------------------
@interface EGMBleSportsOperation : EGMBleOperation
-(void)writeCmdOfFixedDataLength:(NSInteger)cmdId
                       mainCmdId:(NSInteger)mainCmdId;

-(void)writeCmdOfFixedDataLength:(NSInteger)cmdId
                       mainCmdId:(NSInteger)mainCmdId
                        subCmdId:(NSInteger)subCmdId;

-(void)writeCmd:(NSInteger)cmdId
     dataLength:(NSInteger)dataLength
      mainCmdId:(NSInteger)mainCmdId
       subCmdId:(NSInteger)subCmdId;

-(NSData*)buildCmd:(NSInteger)cmdId
        dataLength:(NSInteger)dataLength
         mainCmdId:(NSInteger)mainCmdId
          subCmdId:(NSInteger)subCmdId;

-(void)writeCmd:(NSInteger)cmdId
     dataLength:(NSInteger)dataLength
      mainCmdId:(NSInteger)mainCmdId;

-(NSData*)buildCmd:(NSInteger)cmdId
        dataLength:(NSInteger)dataLength
         mainCmdId:(NSInteger)mainCmdId;

-(void)writeCmd:(NSInteger)cmdId
     dataLength:(NSInteger)dataLength
           data:(NSData*)data;

-(void)writeCmd:(NSData*)cmd;
-(void)writeCmdNoResponse:(NSData*)cmd;

-(NSData*)buildCmd:(NSInteger)cmdId dataLength:(NSInteger)dataLength data:(NSData*)data;
-(void)writeCmdOfReadMassDataInQueue:(NSData*)data massDataListener:(EGMOnMassDataListener*)massDataListener;

-(void)writeCmdOfReadMassDataInQueue:(NSInteger)cmdId dataLength:(NSInteger)dataLength data:(NSData*)data massDataListener:(EGMOnMassDataListener*)massDataListener;
-(void)writeCmdOfReadMassDataInQueue:(NSInteger)cmdId dataLength:(NSInteger)dataLength mainCmdId:(NSInteger)mainCmdId massDataListener:(EGMOnMassDataListener*)massDataListener;
-(void)writeCmdOfReadMassDataInQueue:(NSInteger)cmdId dataLength:(NSInteger)dataLength mainCmdId:(NSInteger)mainCmdId subCmdId:(NSInteger)subCmdId massDataListener:(EGMOnMassDataListener*)massDataListener;
-(void)writeCmdOfReadMassData:(NSInteger)cmdId dataLength:(NSInteger)dataLength data:(NSData*)data massDataListener:(EGMOnMassDataListener*)massDataListener;
-(void)writeCmdOfReadMassData:(NSInteger)cmdId dataLength:(NSInteger)dataLength mainCmdId:(NSInteger)mainCmdId massDataListener:(EGMOnMassDataListener*)massDataListener;
-(void)writeCmdOfReadMassData:(NSInteger)cmdId dataLength:(NSInteger)dataLength mainCmdId:(NSInteger)mainCmdId subCmdId:(NSInteger)subCmdId massDataListener:(EGMOnMassDataListener*)massDataListener;
-(void)writeCmdOfReadMassDataInTransaction:(NSInteger)cmdId dataLength:(NSInteger)dataLength mainCmdId:(NSInteger)mainCmdId subCmdId:(NSInteger)subCmdId massDataListener:(EGMOnMassDataListener*)massDataListener;
@end

//-----------------------------------------------------------
#pragma mark - EGMOnSportsMassDataListener
//-----------------------------------------------------------
@interface EGMOnSportsMassDataListener : EGMOnMassDataListener
-(NSData*) convert2ByteArray:(NSDictionary*)allPacketsMap packetStartIndex:(NSInteger)packetStartIndex packetEndIndex:(NSInteger)packetEndIndex;
-(NSData*)removeFirstByteForEvery16Byte:(NSData*)bytes;
-(NSArray*)getDataIndexForEvery16Byte:(NSData*)bytes;
-(NSInteger)getNexDataIndex:(NSInteger)index;
-(BOOL) isEmptyData:(NSDictionary*)allPacketsMapMap;
@end
